GeoCel DevMailertm 1.0
Installation | Features | Example | Tech Support | Specification
Download Evaluation Copy (100k) | Purchase
The Universal SMTP Mailer
⌐ 1998-1999 Geocel International, Inc.

Introduction
DevMailer is a COM (Component Object Model) object designed to send Email via SMTP from any COM/OLE/ActiveX enabled application. Currently DevMailer can be used from the following platforms:
  • Active Server Pages (Microsoft IIS or Chili!ASP extensions)
  • Microsoft Visual Basic 4.x/5.x/6.x
  • Windows Scripting Host (cscript / wscript)
  • Perl 5.x for Win32
  • Inprise Delphi 4
  • Microsoft Visual C++ 4.x/5.x/6.x
  • Microsoft Visual J++ 1.x/6.0 (Java)

Installation
Install DevMailer in 5 easy steps:

  • Extract the DVMAILER.DLL file to a temporary path. If you do not have a copy of DevMailer, you can obtain it from Geocel International, Inc. Chances are you've already done this.
  • Copy the DVMAILER.DLL file to somewhere on your local hard drive. If you do not have a place dedicated to storing objects you can place it in C:\WINNT\SYSTEM32 (Windows NT) or C:\WINDOWS\SYSTEM (Windows 95/98).
  • Open a MS-DOS command prompt and CD to the directory where you copied DVMAILER.DLL.
  • Run the following command:
    REGSVR32.EXE DVMAILER.DLL
  • If the previous command returns an error, make sure DVMAILER.DLL exists in the current directory. If running REGSVR32.EXE from another directory, you must specify the full path to DVMAILER.DLL.
  • Note: On Windows95 and Windows98, REGSVR32.EXE is located in C:\WINDOWS\SYSTEM32
  • DevMailer is now installed!

Uninstallation

  • Go to the directory DVMAILER.DLL is in.
  • Run the following command:
    REGSVR32.EXE /U DVMAILER.DLL
  • Delete DVMAILER.DLL. (note: you may need to close apps which used it recently)
Features
  • Small, Fast object for sending email via SMTP
  • Unlimited File Attachments
  • Unlimited Backup SMTP Servers
  • Failsafe Message Queueing in case of SMTP Server failure
  • Support for CC and BCC recipients
  • Optimized for concurrent usage (low CPU utilization)
  • Can send multiple messages per connection
  • Verify email addresses at SMTP Server
  • Useful Email utility functions
  • Supports MIME File Attachments, Content-Types, and Character Sets
  • Detailed session logging, as well as the NT Event Log support for fatal errors
  • Works with almost every Win32 based development platform...IN SECONDS!

How DevMailer Works
Internet Email travels via a protocol called SMTP (Simple Mail Tansfer Protocol). DevMailer does the SMTP for you. It takes care of all the error messages a server might return, and provides advanced features like queueing and logging. Below is a basic description of how DevMailer works:

  • You set the required properties of the message/connection. These can be hardcoded, but can alse be user provided input.
  • You call the Send() Method from your program.
  • First, DevMailer connects to the SMTP server. Every domain has at least one SMTP server. If you need the name/IP address of your server, ask your administrator. If you use an ISP, you can use your ISP's SMTP server.
  • If DevMailer is able to connect to the server, it moves on. Otherwise, DevMailer tries all the redundant servers. If DevMailer cannot connect to any servers, the message is Queued.
  • Next, DevMailer notifies the server of the recipients. If no recipients are specified, or all the specified recipients fail, the Send() procedure returns False.
  • Then, DevMailer delivers the message to mail server. DevMailer gets confirmation from the SMTP server.
  • If DevMailer is able to successfully send a message, it then tries to send out any messages existing in the Queue.
  • Finally, DevMailer disconnects from the SMTP server and returns True the message was sucessfully delivered. If Send() returns False, the Queued property specifies whether the message was Queued.
  • Control is returned to You.

How Queueing Works in DevMailer
Messages that DevMailer is unable to send are preserved in the queue directory if your configuration has a valid queue directory. Refer to the QueueDirectory property more information on this procedure. If you do not specify one, queuing defaults to C:\TEMP.

If the message does not contain any errors, but the mail server refuses the message or WindMail is not able to connect to the mail server, the message is saved in the queue directory with extension .QDM.

DevMailer will automatically attempt to flush any queued messages once a successful connection to a mail server is established. Or you may refer to to the FlushQueue() method to force the aforementioned.

Message file format: *.QDM

The top of the queued file contains a message header generated by DevMailer that contains information about the sender, recipient(s), subject, and other fields. This information may have originally come from the message header in the original input file, from parameters specified on the command-line, or from defaults specified in the configuration functions in DevMailer. In most cases, the message header is generated from a combination of all these.

In general, unless there was an error in the message header itself, each generated header file will have at least the following four fields:

To: recipient@somedomain.com
From: support@geocel.com
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
There well likely be other optional fields, such as æSubject:Æ, 'CC:', and æBCC:Æ also present in the generated file, as well as header fields that are ignored by DevMailer but were present in the original input fileÆs message header.

All standard SMTP headers may be used and will function according to the SMTP standards dictated in RFC #822.

The only non-standard header recognized by DevMailer (and handled internally) is 'ATTACH: filename.ext'. Any queued messages with file attachments will include this in the header text. Note that attachments in DevMailer are unlimited, and each attachment will be listed line by line.

Note that these headers need not be in any particular order.

The next section of the of queued file is the message body (text) itself. This is seperated by a blank line between the message header and the message body. The following is a simple example:
 
To: recipient@somedomain.com
From: support@geocel.com
CC: archive@somedomain.com
Subject: Test Message
ATTACH: D:\DIRECTORY\FILE.TXT

This is a the body of the message.

How Logging Works in DevMailer
DevMailer is equipped with advanced logging abilities. This will allow you to diagnose any SMTP problems, as well as any DevMailer usage problems.

DevMailer supports 5 different logging levels. Setting the property LogLevel = 0 will disable it totally. Setting LogLevel = 1 will log any error related messages. In contract, LogLevel = 4 provides an exhaustive log of everything DevMailer does. DevMailer documents every step it takes, and makes a note of server responses to each step.

If a Fatal error occurs, DevMailer writes to the LogFile using the current settings. Additionally, DevMailer writes to the NT Event Log. Sorry, but since Windows95 and Windows98 do not have an Event Log, this feature cannot be supported on these platforms.

Usage Examples (VBScript, Visual Basic)         More

 
	' Geocel DevMailer 1.0
	' VBScript Usage Example
	' (c) 1999, Geocel International, Inc.

	' Create DevMailer Object
	 Set Mailer = CreateObject("Geocel.Mailer")

	' Add first SMTP server
	 Mailer.AddServer "mail",25 
	
	' Set Sender Information
	 Mailer.FromAddress = "support@geocel.com"
	 Mailer.FromName = "Geocel Support"

	' Add a recipient to the message
	 Mailer.AddRecipient "you@yourdomain.com","You"

	' Set the Subject and Body
	 Mailer.Subject = "Welcome to DevMailer"

	 Mailer.Body =	"Test Message Body Line 1" & VbCrLf & _
			"Test Message Body Line 2" & VbCrLf

	' Send Email - Perform Error Checking
	bSuccess = Mailer.Send()

	If bSuccess = False Then
		If Mailer.Queued = False Then
			Response.Write "Could not send message..queueing failed!"
		Else
			Response.Write "Could not send message..queued instead!"
		End If
	Else
		Response.Write "Message Sent Successfully!"
	End If

 
	' Geocel DevMailer 1.0
	' Visual Basic Usage Example
	' (c) 1999, Geocel International, Inc.

	' Create DevMailer Object
	 Set Mailer = CreateObject("Geocel.Mailer")

	' Add first SMTP server
	 Mailer.AddServer "mail",25 
	
	' Set Sender Information
	 Mailer.FromAddress = "support@geocel.com"
	 Mailer.FromName = "Geocel Support"

	' Add a recipient to the message
	 Mailer.AddRecipient "you@yourdomain.com","You"

	' Set the Subject and Body
	 Mailer.Subject = "Welcome to DevMailer"

	 Mailer.Body =	"Test Message Body Line 1" & VbCrLf & _
			"Test Message Body Line 2" & VbCrLf

	' Send Email - Perform Error Checking
	bSuccess = Mailer.Send()

	If bSuccess = False Then
		If Mailer.Queued = False Then
			MsgBox( "Could not send message..queueing failed!" )
		Else
			MsgBox( "Could not send message..queued instead!" )
		End If
	Else
		MsgBox( "Message Sent Successfully!" )
	End If
 

Other Language and Advanced Examples
For examples of DevMailer used in other languages, please visit the DevMailer 1.0 Code Example Archive. We are currently building a database of DevMailer usage examples in a variety of languages. If you implement DevMailer in a unique way and would like to share your experience, send your code implementation to webmaster@geocel.com.

Purchasing / Licensing
For purchasing and licensing information, please visit the DevMailer Home Page at Geocel International, Inc.

Technical Support
Geocel International offers free technical support via our Online Tech Support Request Form. Both pre- and post-sales support is available here. Geocel International also offers incident based Telephone Support. For information about support contracts, please contact sales@geocel.com.

Interface Specifications
In leiu of examples for each and every DevMailer feature, below is a full specification of all Properties and Methods. On the DevMailer Home Page, you can find a variety of examples featuring these options:

   Basic Required Properties/Methods
Type Name VB Usage Example Default
Property
String
R / W )
FromAddress
Mailer.FromAddress = "email@domain.com"
DevMailer
Address message is sent from. Replies go to this address by default, but can be optionally be redirected by the ReplyTo property. 
Property
String
R / W )
Body
Mailer.Body = "Test message body."
none
Message body 
MethodAddServer(server, port)
Mailer.AddServer "mail", 25 
Mailer.AddServer "backup.domain.com", 25 
port usually 25
Add a mail server. Multiple mail servers can be added, and if the first does connect DevMailer will try the next. The number of redundant servers is unlimited. 
MethodAddRecipient(email, name)
Mailer.AddRecipient "email@domain.com", "John Doe" 
Mailer.AddRecipient "email2@domain.com","" 
none
Add a recipient. A friendly name can be specified, in which case the email address would appear "Email Recipient ". Every message must have at least one recipient (can be TO:, CC:, or BCC:). The friendly name can be left blank. 
Method
Boolean
Send()
Success = Mailer.Send()
If Success = True Then 
 Write "Message sent successfully."
Else
 Write "Message could not be sent."
  If Mailer.Queued = True Then
     Write "Message Queued Instead."
  End If
End If
none
Send specified Message to specified Recipients via specified Server. Returns FALSE if message cannot be delivered. 

   Optional Address Properties/Methods
Type Name VB Usage Example Default
Property
String
R / W )
FromName
Mailer.FromName = "John Doe"
none
Friendly name message is sent from. This is usually displayed in email client programs. 
Property
String
R / W )
ReplyTo
Mailer.ReplyTo = "email@domain.com"
none
This property specifies a separate Reply-To address for this message. This overrides the FromAddress when a email client replies to this message. (ie. email@domain.com) 
MethodAddCCRecipient(Email, Name)
Mailer.AddCCRecipient "email@domain.com", "John Doe" 
none
Add a CC: recipient. A friendly name can be specified, in which case the email address would appear "Email Recipient ". CC: recipients are displayed on a separate header line than TO: recipients. 
MethodAddBCCRecipient(Email, Name)
Mailer.AddBCCRecipient "email@domain.com", "John Doe" 
none
Add a BCC: recipient. A friendly name can be specified, but is not displayed. BCC: recipients are never displayed in the message header. 
MethodClearAllRecipients()
Mailer.ClearAllRecipients
none
Clear all TO:, CC:, and BCC: recipients. 
MethodClearToRecipients()
Mailer.ClearToRecipients
none
Clear all TO: recipients. 
MethodClearCCRecipients()
Mailer.ClearCCRecipients
none
Clear all CC: recipients. 
MethodClearBCCRecipients()
Mailer.ClearBCCRecipients
none
Clear all BCC: recipients. 

   Optional Header Properties
Type Name VB Usage Example Default
Property
String
R / W )
Subject
Mailer.Subject = "This is the new Subject"
none
Subject of the message being sent. 
Property
Integer
R / W )
Priority
Mailer.Priority = 1
0
Sets the X-Priority setting in the Message Header. Valid settings are 0 [disabled], and 1 [highest] - 5 [lowest]. 
Property
String
R / W )
ContentType
Mailer.ContentType = "text/html"
"text/plain"
Content-Type for the Body of the message. To create HTML Email set this property to "text/html". 
Property
String
R / W )
CharSet
Mailer.CharSet = "ISO-8859-1"
"us-ascii"
Character Set used in the Message Body. 
Property
Boolean
R / W )
SendRawBody
Mailer.SendRawBody = True
FALSE
Send raw message body, as in Body property. Setting this value to TRUE will cause Header information to be ignored, and will only send the Body. If necessary, a header can be faked here. 
MethodAddRawHeader(name, value)
Mailer.AddRawHeader "X-Organization", "Imaginary Company"
none
Add a Custom Header field. For example: AddRawHeader("TO","email@domain"). 

   Attachment Methods
Type Name VB Usage Example Default
Method
Boolean
AddAttachment(filename)
Success = Mailer.AddAttachment(FileName)
If Success = False Then
  Write "Could not add attachment"
End If
none
Adds an file attachment to the message. Currently, only MIME attachments are supported. Returns TRUE upon success and FALSE upon failure. 
MethodClearAllAttachments()
Mailer.ClearAllAttachments
none
Clears any existing File Attachments. 

   Advanced Connection Properties/Methods
Type Name VB Usage Example Default
Property
Integer
R / W )
ConnectTimeout
Mailer.ConnectTimeout = 30
60
Number of seconds to wait for an SMTP Connection. 
Method
Boolean
Connect()
Success = Mailer.Connect()
If Success = False Then 
  Write "Connection Failed."
End If
none
Manually force Connection to SMTP Server. Send() can be called several times on one connection. By default, this is called automatically by Send(), however Send() will use an existing connection if available. Returns TRUE upon success and FALSE upon failure. 
Method
Boolean
Disconnect()
Success = Mailer.Disconnect()
If Success = False Then 
  Write "Disconnect Failed."
End If
none
Manually disconnect from SMTP Server. This should correspond to a manual Connect() call. Returns TRUE upon success and FALSE upon failure. 
MethodReset()
Mailer.Reset
none
Reset SMTP Connection State and Message settings. If connected, "RSET" is sent to the SMTP Server to reset the server state. 

   Failsafe Queue Properties/Methods
Type Name VB Usage Example Default
Property
Boolean
R / W )
QueueAutomatically
Mailer.QueueAutomatically = False
True
Use this property to control the Auto-Queue feature. By default, messages for which Send() fails are automatically Queued. 
Property
Boolean
R / W )
Queued
If Mailer.Queued = True Then
  Write "Message Successfully Queued"
End If
False
This boolean value is True when the last Send() command failed, and the message was successfully Queued. 
Property
String
R / W )
QueueDirectory
Mailer.QueueDirectory = "D:\DMQUEUE"
C:\TEMP
This property allows the user to specify a custom Queue directory. The user which DevMailer is running as should have full control of this directory. 
Method
Boolean
QueueMessage()
Mailer.QueueMessage()
none
Use this method to Queue the current message. This can only be called once per message. This is automatically called if a server-error occurs while attempting to send a message (and QueueAutomatically = True). 
Method
Integer
FlushQueue()
Mailer.FlushQueue()
none
Use this method to flush the message Queue. All .QDM files in QueueDirectory will be processed. Any messages which fail for non-server reasons are renamed to "FILENAME.QDM.ERR". This is automatically called by Send() when a successful message is sent (and QueueAutomatically = True). Returns the number of messages flushed from Queue. 

   Message File Methods
Type Name VB Usage Example Default
Method
Boolean
LoadBodyFromFile(filename)
Success = Mailer.LoadBodyFromFile("C:\TEMP\REPORT.TXT")
If Success = False Then
  Write "Could not load body file."
End If
none
This method loads the contents of a specified file into the Body of the message. This should be an ASCII file. 
Method
Boolean
LoadMessageFromFile(filename)
Success = Mailer.LoadMessageFromFile("C:\TEMP\REPORT.TXT")
If Success = False Then
  Write "Could not load message file."
End If
none
This method loads the contents of a standard message file into DevMailer. This parses all relevant header information. This can be used to manually load a Queued message file. 

   Demo/Version Properties
Type Name VB Usage Example Default
Property
Boolean
R / W )
IsDemo
If Mailer.IsDemo = True Then
  Write "This is the Demo Version."
End If
True in Demo
False Otherwise
True if this is the Demo version, False if this is a licensed version. 
Property
Integer
R / W )
DemoUsesLeft
Success = Mailer.LoadMessageFromFile("C:\TEMP\REPORT.TXT")
If Success = False Then
  Write "Could not load message file."
End If
250 demo uses
Integer value of Remaing Demo Uses. If IsDemo = True, 0 means that all uses have expired. 
Property
String
R / W )
Version
Write "Software version : " & Mailer.Version
"Geocel DevMailer 1.0"
String value of Product/Version information. 

   LogFile Properties
Type Name VB Usage Example Default
Property
Level
R / W )
LogLevel
Mailer.LogLevel = 0 ' Turn Logging Off
Mailer.LogLevel = 4 ' Verbose Logging
2 - Success
0 - None
1 - Basic (failures only)
2 - Success (log successful sends)
3 - Extended
4 - Verbose (Greatest Logging)
 
Property
String
R / W )
LogFile
Mailer.Logfile = "C:\LOGS\DEVMAILER.LOG"
"C:\TEMP\GEOCEL.LOG"
This is the name of the logfile you wish to use. This of course can be any UNC path.